using UnityEngine;

namespace GameCore
{
    public class Character : MonoBehaviour
    {
        public bool isMoving;
        public Transform root;
        public float time;
        
        private void Update()
        {
            if (isMoving)
            {
                time += Time.deltaTime * 5f;
                root.transform.localPosition = Vector3.up * (Mathf.Sin(time) * 0.2f);
            }
            else
            {
                root.transform.localPosition = Vector3.zero;
            }
        }
        
        public void Move()
        {
            time = 0;
            isMoving = true;
        }

        public void Stop()
        {
            isMoving = false;
        }
    }
}